Namespace DataStream
    <Serializable(), ObfuscationAttribute(Exclude:=True, ApplyToMembers:=True)> _
    Public Class StreamControlSettingCollection
        Inherits KeyedCollectionWithEvents(Of String, StreamControlSetting)

        Private mUpdateRate As UInt16 = 500

        Sub New()
        End Sub

        Protected Overrides Function GetKeyForItem(ByVal item As StreamControlSetting) As String
            Return Item.Name
        End Function
        Public Property UpdateRate() As UInt16
            Get
                Return mUpdateRate
            End Get
            Set(ByVal value As UInt16)
                mUpdateRate = value
            End Set
        End Property
        Overloads Sub CopyTo(ByVal collection As StreamControlSettingCollection) '(Of SettingType))
            If Me.Count > 0 Then
                For Each item As StreamControlSetting In Me
                    If collection.Contains(item.Name) Then
                        collection.Remove(item.Name)
                    End If
                    collection.Add(item)
                Next
            End If
        End Sub

        Public Overrides Sub GetObjectDataAdditionalSerialization(ByVal info As System.Runtime.Serialization.SerializationInfo, ByVal context As System.Runtime.Serialization.StreamingContext)
            info.AddValue("mUpdateRate", mUpdateRate, mUpdateRate.GetType)
        End Sub

        Public Overrides Sub NewAdditionalDeserialization(ByVal Info As System.Runtime.Serialization.SerializationInfo, ByVal context As System.Runtime.Serialization.StreamingContext)
            Try
                mUpdateRate = Info.GetUInt32("mUpdateRate")
            Catch ex As Exception
                mUpdateRate = 500
            End Try
        End Sub
    End Class
End Namespace